package cn.hr.service.impl;

import cn.hr.dao.mapper.SysUserRoleMapper;
import cn.hr.pojo.SysUser;
import cn.hr.pojo.SysUserRole;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.SQLException;
import java.util.List;

/**
 * Created by MO on 2018/12/25.
 */
@CacheConfig(cacheNames = "userRole")
@Scope("prototype")
@Service("userRoleService")
public class SysUserRoleService {
    @Resource
    private SysUserRoleMapper userRoleMapper;

    @Cacheable(keyGenerator = "keyGenerator")
    public List<SysUserRole> findByUserId(int userId) throws Exception {
        return userRoleMapper.findByUserId(userId);
    }

}
